package com.zkingsoft.actions.visitor;

import java.util.Properties;
import java.sql.*;
public class test {
	public static void main(String[] args) {
		
		
		try {
            Class.forName("com.sybase.jdbc2.jdbc.SybDriver").newInstance();
            String url = "jdbc:sybase:Tds:192.168.0.168:5000/master";// 数据库名
            Properties sysProps = System.getProperties();
            sysProps.put("user", "sa"); // 设置数据库访问用户名
            sysProps.put("password", "sybase"); // 密码
            Connection conn = DriverManager.getConnection(url, sysProps);
            Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
            String sql = "select id,name,crdate from dbo.sysobjects where type='U'"; // 表
            ResultSet rs = stmt.executeQuery(sql);
            while (rs.next()) {
                System.out.println("oject_id:"+rs.getString(1)+",oject_name:"+rs.getString(2)); // 取得第二列的值
            }
            rs.close();
            stmt.close();
            conn.close();
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
		
	}
}
